use specs::{ Entity, ReadStorage };
use crate::validators::validator::Validator;
use crate::res::overlord_storage::Overlord;

pub struct MinionshipValidator;

impl<'a> Validator<'a> for MinionshipValidator {
    type SystemData = (
        ReadStorage<'a, Overlord>
    );

    fn validate(&mut self, overlords: &Self::SystemData, performer: Entity, target: Entity) -> bool {
        if let Some(overlord) = overlords.get(target) {
            overlord.0 == performer.id()
        } else {
            false
        }
    }
}